package com.sky.controller.user;

import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author FengHuan Wang
 * @Date 2025/1/1 14:00
 * @Version 1.0
 */
@RestController("userShopController")
@RequestMapping("/user/shop/status")
@Slf4j
@Api(tags = "用户端获取店铺状态接口")
public class ShopController {

    private static final String SHOP_STATUS = "STATUS";
    @Autowired
    private RedisTemplate redisTemplate;
    /*查询店铺状态功能实现*/
    @GetMapping
    @ApiOperation("查询店铺状态")
    public Result<Integer> getStauts(){
        log.info("用户开始查询店铺营业状态");
        Integer status = (Integer) redisTemplate.opsForValue().get(SHOP_STATUS);
        return Result.success(status);
    }
}
